package cn.actionListener;

import cn.action.FighterMoveAction;
import cn.entity.master.Fighter;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class FighterMoveListener implements KeyListener {
    private int x;
    private int y;
    private Fighter fighter;
    private FighterMoveAction fighterMoveAction;


    public FighterMoveListener(Fighter fig) {
        fighterMoveAction= new FighterMoveAction();
        fighter = fig;
    }

    @Override
    public void keyTyped(KeyEvent e) {

    }

    @Override
    public void keyPressed(KeyEvent e) {
        int key = e.getKeyCode();
       fighterMoveAction.move(key);
    }

    @Override
    public void keyReleased(KeyEvent e) {
        int key = e.getKeyCode();
       fighterMoveAction.stop(key);
    }
}
